import { Outlet, Navigate } from "react-router-dom";
import { createRef } from "react";
import { SuspenseComponent } from "@/utils/MyFun";

const article = {
  name: "文章管理",
  path: "/article",
  element: <Outlet />, //子路由存放在这里
  nodeRef: createRef(null),
  meta: {
    title: "文章管理",
    icon: "ic:twotone-article",
    order: 1,
    keepAlive: true,
    // role: ['admin'],
    // requireAuth: true,
  },
  children: [
    {
      path: "/article",
      element: <Navigate to="/article/list" />,
      nodeRef: createRef(null),
      redirect: true,
    },
    {
      name: "文章列表",
      path: "list",
      element: SuspenseComponent("/article/list"), //必须这么传入.index.jsx可传默认查找
      nodeRef: createRef(null),
      isHidden: false,

      meta: {
        title: "文章列表",
        icon: "material-symbols:format-list-bulleted",
        // role: ['admin'],
        // requireAuth: true,
        keepAlive: true,
        order: 2,
      },
    },
    {
      name: "发布文章",
      path: "write",
      element: SuspenseComponent("/article/write"),
      nodeRef: createRef(null),
      isHidden: false,
      meta: {
        title: "发布文章",
        icon: "icon-park-outline:write",
        // role: ['admin'],
        // requireAuth: true,
        keepAlive: true,
        order: 1,
      },
    },
    {
      name: "编辑文章",
      path: "write/:id",
      element: SuspenseComponent("/article/write"),
      nodeRef: createRef(null),
      isHidden: true,
      meta: {
        title: "编辑文章",
        icon: "icon-park-outline:write",
        order: 1,
        // role: ['admin'],
        // requireAuth: true,
        keepAlive: true,
      },
    },
    {
      name: "分类管理",
      path: "category",
      element: SuspenseComponent("/article/category"),
      nodeRef: createRef(null),
      isHidden: false,
      meta: {
        title: "分类管理",
        icon: "tabler:category",
        // role: ['admin'],
        // requireAuth: true,
        keepAlive: true,
        order: 3,
      },
    },
    {
      name: "标签管理",
      isHidden: false,
      path: "tag",
      element: SuspenseComponent("/article/tag"),
      nodeRef: createRef(null),
      meta: {
        title: "标签管理",
        icon: "tabler:tag",
        keepAlive: true,
        order: 4,
      },
    },
  ],
};

export default article;
